﻿using System;
using System.ComponentModel;
using System.Windows;

namespace Groovy_IM.Assets.Buddylist
{
    public class Buddy : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        private Uri _buddyIcon;

        public Uri BuddyIcon
        {
            get
            {
                return _buddyIcon;
            }
            set
            {
                _buddyIcon = value;
                NotifyPropertyChanged("BuddyIcon");
            }
        }

        private Uri _buddyProtocol;

        public Uri BuddyProtocol
        {
            get
            {
                return _buddyProtocol;
            }
            set
            {
                _buddyProtocol = value;
                NotifyPropertyChanged("BuddyProtocol");
            }
        }

        private string _buddyStatus;

        public string BuddyStatus
        {
            get 
            { 
                return _buddyStatus; 
            }
            set
            {
                _buddyStatus = value;
                NotifyPropertyChanged("BuddyStatus");
            }
        }

        private string _RMeta;

        public string RMeta
        {
            get
            {
                return _RMeta;
            }
            set
            {
                _RMeta = value;
                NotifyPropertyChanged("RMeta");
            }
        }

        private string _RScreenname;

        public string RScreenname
        {
            get
            {
                return _RScreenname;
            }
            set
            {
                _RScreenname = value;
                NotifyPropertyChanged("RScreenname");
            }
        }

        private string _Screenname;

        public string Screenname
        {
            get 
            {
                return _Screenname; 
            }
            set
            {
                _Screenname = value;
                NotifyPropertyChanged("Screenname");
            }
        }

        private Uri _userStatus;

        public Uri UserStatus
        {
            get
            {
                return _userStatus;
            }
            set
            {
                _userStatus = value;
                NotifyPropertyChanged("UserStatus");
            }
        }

        private Visibility _collapseVisibility = Visibility.Visible;

        public Visibility CollapseVisibility
        {
            get 
            { 
                return _collapseVisibility; 
            }
            set
            {
                _collapseVisibility = value;
                NotifyPropertyChanged("CollapseVisibility");
            }
        }

        public Buddy(string BuddyName, string RealBuddyName, string RealMeta, string Status, Uri Protocol, Uri Avatar, Uri BStatus)
        {
            Screenname = BuddyName;
            BuddyStatus = Status;
            BuddyProtocol = Protocol;
            BuddyIcon = Avatar;
            UserStatus = BStatus;
            RScreenname = RealBuddyName;
            RMeta = RealMeta;
        }

        protected void NotifyPropertyChanged(string thePropertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(thePropertyName));
            }
        }
    }
}
